import { createSSRApp } from 'vue'
import VConsole from 'vconsole'
import App from './App.vue'
import store from './store'
import { prototypeInterceptor, routeInterceptor } from './interceptors'
import 'virtual:uno.css'
import '@/style/index.scss'
import globalShare from './mixins/globalShare'
// #ifdef H5
import { isWechatBrowser } from '@/utils/platform'
import VueLazyload from 'vue-lazyload'
if (import.meta.env.VITE_DELETE_CONSOLE === 'false' && isWechatBrowser()) {
  const vConsole = new VConsole()
}
// #endif


export function createApp() {
  const app = createSSRApp(App)

  // #ifdef H5
  app.use(VueLazyload, {
    lazyComponent: true,
  })
  // #endif
  app.use(store)
  app.use(routeInterceptor)
  app.use(prototypeInterceptor)

  app.mixin(globalShare)

  return {
    app,
  }
}
